package com.xiaotu.spring.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

/**
 * @author zhangxiao
 * @create 2021-11-09 14:51
 */
@Slf4j
public class BeanE implements InitializingBean, DisposableBean {

    private String name = "张三";

    private Integer age = 1;

    public BeanE() {
        log.info("BeanE Constructor...");
    }

    @PostConstruct
    public void beanEPostConstruct() {
        log.info("BeanE PostConstruct...");
    }

    public void init() {
        log.info("BeanE init...");
    }

    public void destroy() {
        log.info("BeanE destroy...");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("BeanE afterPropertiesSet...");
        this.name = "王五";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
